home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / pango-1.0 / pango / pangofc-fontmap.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-04-25  |  7.1 KB  |  178 lines

  1. /* Pango
  2.  * pangofc-fontmap.h: Base fontmap type for fontconfig-based backends
  3.  *
  4.  * Copyright (C) 2003 Red Hat Software
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Library General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the GNU
  14.  * Library General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Library General Public
  17.  * License along with this library; if not, write to the
  18.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19.  * Boston, MA 02111-1307, USA.
  20.  */
  21.  
  22. #ifndef __PANGO_FC_FONT_MAP_H__
  23. #define __PANGO_FC_FONT_MAP_H__
  24.  
  25. #include <fontconfig/fontconfig.h>
  26. #include <pango/pango-fontmap.h>
  27. #include <pango/pangofc-decoder.h>
  28. #include <pango/pangofc-font.h>
  29.  
  30. G_BEGIN_DECLS
  31.  
  32. #define PANGO_TYPE_FC_FONT_MAP              (pango_fc_font_map_get_type ())
  33. #define PANGO_FC_FONT_MAP(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FC_FONT_MAP, PangoFcFontMap))
  34. #define PANGO_IS_FC_FONT_MAP(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FC_FONT_MAP))
  35.  
  36. typedef struct _PangoFcFontMap        PangoFcFontMap;
  37. typedef struct _PangoFcFontMapClass   PangoFcFontMapClass;
  38. typedef struct _PangoFcFontMapPrivate PangoFcFontMapPrivate;
  39.  
  40. #ifdef PANGO_ENABLE_BACKEND
  41.  
  42. #define PANGO_FC_FONT_MAP_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FC_FONT_MAP, PangoFcFontMapClass))
  43. #define PANGO_IS_FC_FONT_MAP_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FC_FONT_MAP))
  44. #define PANGO_FC_FONT_MAP_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FC_FONT_MAP, PangoFcFontMapClass))
  45.  
  46. /**
  47.  * PangoFcFontMap:
  48.  * 
  49.  * #PangoFcFontMap is a base class for font map implementations
  50.  * using the FontConfig and FreeType libraries. To create a new
  51.  * backend using Fontconfig and FreeType, you derive from this class
  52.  * and implement a new_font() virtual function that creates an
  53.  * instance deriving from #PangoFcFont.
  54.  **/
  55. struct _PangoFcFontMap
  56. {
  57.   PangoFontMap parent_instance;
  58.  
  59.   PangoFcFontMapPrivate *priv;
  60. };
  61.  
  62. /**
  63.  * PangoFcFontMapClass:
  64.  * @default_substitute: Substitutes in default values for
  65.  *  unspecified fields in a #FcPattern. This will be called
  66.  *  prior to creating a font for the pattern. May be %NULL.
  67.  *  Deprecated in favor of @context_substitute().
  68.  * @new_font: Creates a new #PangoFcFont for the specified
  69.  *  pattern of the appropriate type for this font map. The
  70.  *  @pattern argument must be passed to the "pattern" property
  71.  *  of #PangoFcFont when you call g_object_new(). Deprecated
  72.  *  in favor of @create_font().
  73.  * @get_resolution: Gets the resolution (the scale factor
  74.  *  between logical and absolute font sizes) that the backend
  75.  *  will use for a particular fontmap and context. @context
  76.  *  may be null.
  77.  * @context_key_get: Gets an opaque key holding backend
  78.  *  specific options for the context that will affect
  79.  *  fonts created by create_font(). The result must point to
  80.  *  persistant storage owned by the fontmap. This key
  81.  *  is used to index hash tables used to look up fontsets
  82.  *  and fonts.
  83.  * @context_key_copy: Copies a context key. Pango uses this
  84.  *  to make a persistant copy of the value returned from
  85.  *  @context_key_get.
  86.  * @context_key_free: Frees a context key copied with
  87.  *  @context_key_copy.
  88.  * @context_key_hash: Gets a hash value for a context key
  89.  * @context_key_equal: Compares two context keys for equality.
  90.  * @create_font: Creates a new #PangoFcFont for the specified
  91.  *  pattern of the appropriate type for this font map using
  92.  *  information from the context that is passed in. The
  93.  *  @pattern argument must be passed to the "pattern" property
  94.  *  of #PangoFcFont when you call g_object_new(). Deprecated
  95.  *  in favor of @create_font(). If %NULL, new_font() is used.
  96.  * @context_substitute: Substitutes in default values for
  97.  *  unspecified fields in a #FcPattern. This will be called
  98.  *  prior to creating a font for the pattern. May be %NULL.
  99.  *
  100.  * Class structure for #PangoFcFontMap.
  101.  **/
  102. struct _PangoFcFontMapClass
  103. {
  104.   /*< private >*/
  105.   PangoFontMapClass parent_class;
  106.  
  107.   /*< public >*/
  108.   /* Deprecated in favor of context_substitute */
  109.   void         (*default_substitute) (PangoFcFontMap   *fontmap,
  110.                           FcPattern        *pattern);
  111.   /* Deprecated in favor of create_font */
  112.   PangoFcFont  *(*new_font)          (PangoFcFontMap  *fontmap,
  113.                           FcPattern       *pattern);
  114.  
  115.   double       (*get_resolution)     (PangoFcFontMap             *fcfontmap,
  116.                       PangoContext               *context);
  117.   
  118.   gconstpointer (*context_key_get)   (PangoFcFontMap             *fcfontmap,
  119.                       PangoContext               *context);
  120.   gpointer     (*context_key_copy)   (PangoFcFontMap             *fcfontmap,
  121.                       gconstpointer               key);
  122.   void         (*context_key_free)   (PangoFcFontMap             *fcfontmap,
  123.                       gpointer                    key);
  124.   guint32      (*context_key_hash)   (PangoFcFontMap             *fcfontmap,
  125.                       gconstpointer               key);
  126.   gboolean     (*context_key_equal)  (PangoFcFontMap             *fcfontmap,
  127.                       gconstpointer               key_a,
  128.                       gconstpointer               key_b);
  129.   
  130.   void         (*context_substitute) (PangoFcFontMap             *fontmap,
  131.                       PangoContext               *context,
  132.                           FcPattern                  *pattern);
  133.   PangoFcFont  *(*create_font)       (PangoFcFontMap             *fontmap,
  134.                       PangoContext               *context,
  135.                       const PangoFontDescription *desc,
  136.                           FcPattern                  *pattern);
  137.   /*< private >*/
  138.  
  139.   /* Padding for future expansion */
  140.   void (*_pango_reserved1) (void);
  141.   void (*_pango_reserved2) (void);
  142.   void (*_pango_reserved3) (void);
  143.   void (*_pango_reserved4) (void);
  144. };
  145.  
  146. PangoContext * pango_fc_font_map_create_context (PangoFcFontMap *fcfontmap);
  147. void           pango_fc_font_map_cache_clear    (PangoFcFontMap *fcfontmap);
  148. void           pango_fc_font_map_shutdown       (PangoFcFontMap *fcfontmap);
  149.  
  150. #endif
  151.  
  152. GType pango_fc_font_map_get_type (void);
  153.  
  154. /**
  155.  * PangoFcDecoderFindFunc:
  156.  * @pattern: a fully resolved #FcPattern specifying the font on the system
  157.  * @user_data: user data passed to pango_fc_font_map_add_decoder_find_func()
  158.  * 
  159.  * Callback function passed to pango_fc_font_map_add_decoder_find_func().
  160.  * 
  161.  * Return value: a new reference to a custom decoder for this pattern,
  162.  *  or %NULL if the default decoder handling should be used.
  163.  **/
  164. typedef PangoFcDecoder * (*PangoFcDecoderFindFunc) (FcPattern *pattern,
  165.                             gpointer   user_data);
  166.  
  167. void pango_fc_font_map_add_decoder_find_func (PangoFcFontMap        *fcfontmap,
  168.                           PangoFcDecoderFindFunc findfunc,
  169.                           gpointer               user_data,
  170.                           GDestroyNotify         dnotify);
  171.  
  172. PangoFontDescription *pango_fc_font_description_from_pattern (FcPattern *pattern,
  173.                                   gboolean   include_size);
  174.  
  175. G_END_DECLS
  176.  
  177. #endif /* __PANGO_FC_FONT_MAP_H__ */
  178.